package com.sc.test.app;

import android.app.Application;

import com.alibaba.android.arouter.launcher.ARouter;
import com.sc.test.BuildConfig;
import com.sc.test.dagger2.BaseComponent;
import com.sc.test.dagger2.BaseModule;
import com.sc.test.dagger2.DaggerBaseComponent;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import com.tencent.mars.xlog.LogUtil;

/**
 * Created by Shen Chao on 2018-01-10-010 下午 19:48.
 */

public class App extends Application {
    private RefWatcher refWatcher;
    private BaseComponent baseComponent;

    @Override
    public void onCreate() {
        super.onCreate();
        refWatcher = LeakCanary.install(this);
        baseComponent = DaggerBaseComponent.builder().baseModule(new BaseModule()).build();

//        if (isDebug()) {           // These two lines must be written before init, otherwise these configurations will be invalid in the init process
            ARouter.openLog();     // Print log
            ARouter.openDebug();   // Turn on debugging mode (If you are running in InstantRun mode, you must turn on debug mode! Online version needs to be closed, otherwise there is a security risk)
//        }
        //路由初始化
        ARouter.init(this);

        //初始化log
//        LogUtil.getInstance().init(true);
    }

    public BaseComponent getBaseComponent() {
        return baseComponent;
    }
}
